home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13852 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.nask.org.pl!usenet
  2. From: flssoft@blue.maloka.waw.pl (Grzegorz (FLS))
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: A question about serialization and MFC in VC++.
  5. Date: Wed, 27 Mar 1996 19:12:24 GMT
  6. Organization: Research and Academic Computer Network
  7. Message-ID: <4jc3qe$s35@bilbo.nask.org.pl>
  8. NNTP-Posting-Host: s114.maloka.waw.pl
  9. X-Newsreader: Forte Free Agent v0.46
  10.  
  11. >   MyClass *ptr;
  12.  
  13. >   ptr=new MyClass();
  14.  
  15. >   ptr->Serialize();
  16.  
  17. >But this only gets the first record.  I can't seem to get feof to work 
  18. >with the CArchive class (as in: while(!(feof(ar))  ).
  19.  
  20.  
  21. Hi,
  22.  
  23. This is good idea to write before MyClass serialization the number of
  24. elements of MyClass type. For example for CString class, the
  25. serialization saves the number of characters first, and thereafter
  26. this characters. If you wish to save n objects of MyClass elements,
  27. do:
  28.  
  29.     ar << number_of_MyClass_elements ;
  30.     for each object do
  31.         ar << objectOfMyClass
  32.  
  33. If you save your objects in the list of CObList type, the
  34. serialization fo CObList class will do it itself.
  35.  
  36. Grzegorz
  37.  
  38. ``````````````````````````` Grzes vel Pysiak
  39. Ablue, pecte canem, canis est et permanet idem.
  40. Desunt cetera!
  41.  
  42.